﻿/*****************************************************************//**
 * @file    FITKAcousticsVTKGraphObject3DPost.h
 * @brief   Graph object base for post 3D.
 *  
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-11-21
 *********************************************************************/

#ifndef __FITKACOUSTICSVTKGRAPHOBJECT3DPOST_H__
#define __FITKACOUSTICSVTKGRAPHOBJECT3DPOST_H__

#include "FITKAcousticsVTKGraphObject3D.h"

#include "FITKAcousticsVTKGraphAdaptorAPI.h"

// Forward declaration
class vtkLookupTable;
class vtkScalarsToColors;

class FITKAcousticsVTKGraphActor;

namespace Exchange
{
    /**
     * @brief   Graph object base for post 3D.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-11-21
     */
    class FITKACOUSTICSGRAPHADAPTORAPI FITKAcousticsVTKGraphObject3DPost : public FITKAcousticsVTKGraphObject3D
    {
        // Regist
        FITKGraphObjectRegist(FITKAcousticsVTKGraphObject3DPost, FITKAcousticsVTKGraphObject3D);
        FITKCLASS(Exchange, FITKAcousticsVTKGraphObject3DPost);

    public:
        /**
         * @brief   Constructor.
         * @param   dataObj: The data object
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-21
         */
        FITKAcousticsVTKGraphObject3DPost(Core::FITKAbstractDataObject* dataObj);

        /**
         * @brief   Destructor.[virtual]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-21
         */
        virtual ~FITKAcousticsVTKGraphObject3DPost() = default;

        /**
         * @brief   Save the post data dict.[virtual]
         * @param   arrayName: The array name of the post data
         * @param   data: The post data
         *          The key is the data object name.
         *          The value is the post value.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-21
         */
        virtual void setPostData(QString arrayName, QHash<QString, float> & data);

        /**
         * @brief   Update the color by the data color array in cell data.[virtual]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-21
         */
        virtual void updateByDataColor();

        /**
         * @brief   Update the color by the post data for cell data.[virtual]
         * @param   arrayName: The data array name
         * @param   rangeMin: The min range for the look up table
         * @param   rangeMax: The max range for the look up table
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-21
         */
        virtual void updateByPostCellData(QString arrayName, double rangeMin, double rangeMax);

        /**
         * @brief   Update the color by the NULL post data for cell data.[virtual]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-21
         */
        virtual void updateByPostNullData();

        /**
         * @brief   Enable or disbale log scale mode.[virtual]
         * @param   isOn: Enable or disable
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-28
         */
        virtual void setEnableLogScale(bool isOn);

    protected:
        /**
         * @brief   Initialize the look up table.
         * @param   lut: The look up table
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-22
         */
        void initLookUptable(vtkScalarsToColors* lut);

        /**
         * @brief   Get the actor's look up table, create one if the actor does not exist.
         * @param   actor: The actor
         * @return  The look up table
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-21
         */
        vtkLookupTable* getActorLut(vtkActor* actor);

        /**
         * @brief   Set the value to the full dataset's cell data.
         * @param   dataSet: The dataset
         * @param   arrayName: The data array name
         * @param   value: The value
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-21
         */
        void setValueToCellData(vtkDataSet* dataSet, QString arrayName, double value);

    };
}   // namespace Exchange

#endif // __FITKACOUSTICSVTKGRAPHOBJECT3DPOST_H__
